package com.onlyxiahui.common.data.common.builder;

import com.onlyxiahui.common.data.base.HeadImpl;
import com.onlyxiahui.common.message.push.PushBodyMessage;
import com.onlyxiahui.common.message.push.PushMessage;

/**
 * 
 * Date 2019-02-17 11:25:44<br>
 * Description
 * 
 * @author XiaHui<br>
 * @since 1.0.0
 */
public class PushMessageBuilder {

	public static PushMessage build(String key, String action, String method) {
		HeadImpl head = HeadBuilder.build(key, action, method);
		PushMessage message = new PushMessage();
		message.setHead(head);
		return message;
	}

	public static PushMessage build(String action, String method) {
		return build(null, action, method);
	}

	public static <T> PushBodyMessage<T> buildBody(String key, String action, String method, T body) {
		HeadImpl head = HeadBuilder.build(key, action, method);
		PushBodyMessage<T> message = new PushBodyMessage<>(body);
		message.setHead(head);
		return message;
	}

	public static <T> PushBodyMessage<T> buildBody(String action, String method, T body) {
		return buildBody(null, action, method, body);
	}
}